package com.cloud.pole.shop.biz.shops;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ace.cache.annotation.Cache;
import com.ace.cache.annotation.CacheClear;
import com.cloud.pole.common.biz.BaseBiz;
import com.cloud.pole.mapper.shops.ShopShopsComponentMapper;
import com.cloud.pole.shop.model.entity.shops.ShopShopsComponent;

@Service
@Transactional(rollbackFor = Exception.class)
public class ShopShopsComponentBiz extends BaseBiz<ShopShopsComponentMapper, ShopShopsComponent> {
	
	@Cache(key="ShopShopsComponent-shopId{1}")
    public ShopShopsComponent selectByShopId(Integer shopId) {
		ShopShopsComponent ssc = new ShopShopsComponent();
		ssc.setShopId(shopId);
		ssc.setComponentStatus(1);
		ssc.setDeleteFlag(0);
		 return mapper.selectOne(ssc);
    }
	
	public List<ShopShopsComponent> selectPageShopAdminList(Integer shopId){
		return mapper.selectByList(shopId);
	}
	
	@CacheClear(key = "ShopShopsComponent-shopId{1.shopId}")
	public void addShopShopsComponent(ShopShopsComponent shopShopsComponent) {
		mapper.addopendShopComponent(shopShopsComponent);
	}
	
	public ShopShopsComponent selectByComponentId(Integer componentId) {
		return mapper.selectByComponentIdMa(componentId);
	}
	
	@CacheClear(key = "ShopShopsComponent-shopId{1.shopId}")
	public void updateShopShopsComponent(ShopShopsComponent shopShopsComponent) {
		mapper.updateopendShopComponent(shopShopsComponent);
	}
}
